// import proFetch from "../../../../public/functions/project-fetch";
import {hrAjax as ajax} from 'src/hrpub/common/utils/utils';

import handlePK from "./handlePK";
import {transRadio} from "../../../../../hrpub/common/utils/utils";
import setButtonStatus from "../../container/functions/setButtonStatus";

import {promptBox} from 'nc-lightapp-front';
import deepCopy from '../../../../../hrpub/common/utils/deep-copy';

export default function getOneDisputedInfo(callback) {
    const {orgVal, page} = this.state;
    const {form} = this.props;
    let postData = {
        pk_org: orgVal && orgVal.refpk,
        pk_workdispute: handlePK.get()
    };

    return ajax({
        url: '/nccloud/hrcm/disputed/DisputedQueryOneAction.do',
        body: postData,
    })
        .then((res) => {
            if (res.success) {
                if(page === 'edit'){
                    form.setFormStatus('detail', 'edit');//设置卡片编辑状态
                }
                let data = deepCopy(res.data)
                if (data) {
                    let rowData = data.detail.rows[0].values;
                    Object.keys(rowData).forEach(key => {
                        if(rowData[key].value === null){
                            rowData[key].value = '';
                        }
                    });
                    res.data.detail.rows[0].values = rowData;
                    // 这里
                    // let formData = transRadio(res.data.detail.rows, true, ["Y", "N"], ['isclawsolve', 'iscomposesolve', 'isintercesolve'], ['是', '否']);
                    form.setAllFormValue({'detail': res.data.detail})
                    callback && callback();
                } else {
                    form.EmptyAllFormValue('detail');
                    callback && callback();
                }
            }
        });
}
